<%@page language="java" contentType="text/html;charset=UTF-8" %>
<%@page import="java.util.*"%>
<%@page import="weaver.file.FileUpload"%>
<%@page import="weaver.general.Util"%>
<%@page import="java.net.URLDecoder"%>
<%@page import="weaver.hrm.*" %>
<%@ page import="weaver.systeminfo.*" %>
<%@page import="weaver.conn.RecordSet" %>
<%@page import="weaver.mobile.plugin.ecology.service.HrmResourceService"%>
<%@page import="weaver.general.TimeUtil"%>
<%@page import="weaver.email.service.*"%>
<%@page import="weaver.hrm.resource.ResourceComInfo"%>
<%@page import="weaver.splitepage.transform.SptmForMail"%>
<%@page import="weaver.email.WeavermailUtil"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="net.sf.json.*"%>
<%@page import="weaver.email.WeavermailComInfo"%>
<%@ page import="weaver.email.domain.*" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="weaver.systeminfo.*" %>
<%@ page import="weaver.general.StaticObj" %>
<%@ page import="weaver.hrm.settings.RemindSettings" %>
<%@ page import="org.apache.commons.logging.Log"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<%@ page import="weaver.docs.category.security.AclManager" %>
<%@ page import="weaver.general.GCONST"%>
<%@page import="weaver.general.AttachFileUtil"%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="java.io.*"%>
<%@page import="weaver.hrm.company.DepartmentComInfo"%>
<%@page import="weaver.hrm.company.SubCompanyComInfo"%>
<%@page import="weaver.email.MailSend"%>
<%@page import="weaver.general.BaseBean"%>
<%@page import="com.weaver.formmodel.mobile.manager.MobileUserInit"%>

<jsp:useBean id="MailConfigService" class="weaver.email.service.MailConfigService" scope="page" />
<jsp:useBean id="mms" class="weaver.email.service.MailManagerService" scope="page" />
<jsp:useBean id="mrs" class="weaver.email.service.MailResourceService" scope="page" />
<jsp:useBean id="mas" class="weaver.email.service.MailAccountService" scope="page" />
<jsp:useBean id="resourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page" />
<jsp:useBean id="mss" class="weaver.email.service.MailSettingService" />
<jsp:useBean id="mrfs" class="weaver.email.service.MailResourceFileService" />
<jsp:useBean id="lms" class="weaver.email.service.LabelManagerService" scope="page" />
<jsp:useBean id="fms" class="weaver.email.service.FolderManagerService" scope="page" />
<jsp:useBean id="cms" class="weaver.email.service.ContactManagerService" scope="page" />
<jsp:useBean id="SptmForMail" class="weaver.splitepage.transform.SptmForMail" />
<jsp:useBean id="rs0" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rst" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="WeavermailUtil" class="weaver.email.WeavermailUtil" scope="page" />
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="mailSend" class="weaver.email.MailSend" scope="page" />

<%
out.clearBuffer();
request.setCharacterEncoding("UTF-8");
String operation = Util.null2String(request.getParameter("operation"));
String userid = Util.null2String(request.getParameter("userid"));
HrmResourceService hrs = new HrmResourceService();
User user = hrs.getUserById(Util.getIntValue(userid));
if(user==null){
	user = MobileUserInit.getUser(request,response);
}
if(user==null) {
	Map result = new HashMap();
	//未登录或登录超时
	result.put("error", "200001");
	JSONObject jo = JSONObject.fromObject(result);
	out.println(jo);
	return;
}
out.clear();
String isSent = "";
 try{
	isSent = mailSend.sendMail(request, user) ;
}catch(Exception e){
	e.printStackTrace();
	isSent="false";
}
out.print("<script>parent.doSubmitResult('"+isSent+"');</script>");


%>
